﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Newtonsoft.Json;

namespace SocketioTest.Common
{
    public class HttpRequest_All
    {
        private static string strjson;

        //登录
        public static string GoLogin(String UserTextBox, String PwdTextBox)
        {
            try
            {
                var postUrl = Global.urlPath;
                StringBuilder pram = new StringBuilder();
                pram.Append("/users/login");
                pram.Append("?account=" + UserTextBox);
                pram.Append("&password=" + PwdTextBox);
          
                string postDataStr = pram.ToString();
                strjson = HttpRequestHelper.HttpGetRequest(postUrl + postDataStr);
               
                if (string.IsNullOrEmpty(strjson))
                {
                    Log.WriteLog("连接服务器失败:" + (object)strjson);
                }
                
                pram = (StringBuilder)null;
            }
            catch (Exception ex)
            {
                MessageBox.Show("服务器链接失败");
                Log.WriteLog(ex);
            }
            return strjson;
        }

    }
    
}
